#include <iostream>
#include "../../cmd/cmd.h"
#include "../../cmd/cmdfactor.h"
#include "../../cmdsql/cmdsql.h"
#include "../../socket/mysocket.h"
#include "../../sql/sql.h"
#include "../../sqltask/sqltask.h"
#include "../../threadpoll/threadpool.h"


int main(){

    cout<<"<<<<<<<<<<<<<\n";
    cSocket s("127.0.0.1",8080);
    
    string str;
    while(1)
    {
        getline(cin,str);
        if(cmd* cmdptr = cfs.getcmdptr(str))
        {
            if(cmdptr->isvalid()){
                cout<<"main: check pass\n";
                //if(s.clientsocketid)
                
                cmdptr->getcmdlineitems();
                if(cmdptr->cmdlineitems[0]==string("login"))
                {
                    s.init();
                }
                s.sendmsg(str);
            }else{
                cout<<"main: cmd invalid\n";
            }
        }else{
            cout<<"main: check failed\n";
        }
    }
    cout<<"<<<<<<<<<<<<<\n";


    return 0;
}